﻿var sql = require( 'node-sqlserver' );
var config = require( "../Database/dbConfig" );

/*
 * 打开数据库连接，返回Connection对象 
 */
exports.openNodeConn = function ( fn ) {
    sql.open( config.conn_str, function ( err, conn ) {

        if ( err ) {
            console.log( "Open Sqlserver Error: " + err );
            return null;
        }

        //console.log( 'Connect ' + config.database + ' OK;' );

        if ( fn && typeof fn == "function" ) fn( conn );
    });
};